﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

namespace HeathCareSystem
{
    public class LoaiTaiKhoanDAO
    {
        DataProvider dp = new DataProvider();

        public List<LoaiTaiKhoanDTO> LayDanhSachLoaiTaiKhoan()
        {
            List<LoaiTaiKhoanDTO> listKetQua = new List<LoaiTaiKhoanDTO>();
            LoaiTaiKhoanDTO ltkDTO;
            DataTable dt = new DataTable();
            string strSQL = string.Format("SELECT MaLoaiTaiKhoan, TenLoaiTaiKhoan FROM LOAITAIKHOAN");
            dt = dp.ExecuteQuery(strSQL);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i][0].ToString() != "LTK04")
                {
                    ltkDTO = new LoaiTaiKhoanDTO();
                    ltkDTO.maLoaiTaiKhoan = dt.Rows[i][0].ToString();
                    ltkDTO.tenLoaiTaiKhoan = dt.Rows[i][1].ToString();
                    listKetQua.Add(ltkDTO);
                }
                    
            }
            return listKetQua;
        }
    }
}